//
//  ControllerManger.m
//  囧途
//
//  Created by fly on 16/3/3.
//  Copyright © 2016年 fly. All rights reserved.
//

#import "ControllerManger.h"
#import "LeftViewController.h"
//#import "HomeViewController.h"
@interface ControllerManger ()
@property (nonatomic, strong)DrawerViewController *drawerVC;

//@property(nonatomic, strong)ViewController *viewVC;

@property(nonatomic, strong)HomeViewController * homeVC;

@property (nonatomic, strong) UINavigationController *navigationController;

@end
@implementation ControllerManger

+ (instancetype)sharedManager{
    static ControllerManger *manageer = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manageer = [[ControllerManger alloc] init];
    });
    return manageer;
}
- (UIViewController *)rootVC{
    return self.drawerVC;
}

- (DrawerViewController *)drawerVC{
    if (!_drawerVC) {
        // 这里穿进去的是homeVC并不是导航控制器，  下面哪样初始化没用
        _drawerVC  = [[DrawerViewController alloc] initWithMainViewController:self.navigationController leftViewController:[LeftViewController new]];
    }
    return _drawerVC;
}
/**
 *  在这里设置了根控制器没用应该你在上面那个方法哪儿初始化传进去的还是homeVC 并不是导航控制器
 */
-(HomeViewController *)homeVC
{
    if (!_homeVC) {
        
        _homeVC= [[HomeViewController alloc]init];

        
        
    }
    return _homeVC;
}
/**
 *  添加一个导航控制器属性
 */
- (UINavigationController *)navigationController
{
    if (!_navigationController) {
        _navigationController = [[UINavigationController alloc] initWithRootViewController:self.homeVC];
        [_navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"首页背景1"] forBarMetrics:UIBarMetricsDefault];
    }
    return _navigationController;
}




@end
